#define _CRT_SECURE_NO_WARNINGS 1
#include "mylist.h"
#include<iostream>
#include<list>
using namespace std;
void test1()
{
	mylist::list<int> ls;
	ls.push_back(1);
	ls.push_back(2);
	ls.push_back(3);
	for (auto e : ls)
	{
		cout << e << " ";
	}
	cout << endl;
	ls.insert(ls.end(), 4);
	cout << ls.size() << endl << endl;
	cout << ls.front() << endl << endl;
	cout << ls.back() << endl << endl;
}
void test2()
{
	mylist::list<int> ls;
	ls.push_back(1);
	ls.push_back(2);
	ls.push_back(3);
	ls.push_back(4);
	ls.push_back(5);
	mylist::list<int> ls1(ls);
	for (auto e : ls1)
	{
		cout << e << " ";
	}
	cout << endl;
	mylist::list<int> ls2 = ls;
	for (auto e : ls2)
	{
		cout << e << " ";
	}
	cout << endl;
}
void test3()
{
	mylist::list<int> ls;
	ls.push_back(1);
	ls.push_back(2);
	ls.push_back(3);
	ls.push_back(4);
	ls.push_back(5);

	for (auto e : ls)
	{
		cout << e << " ";
	}
	cout << endl;
	ls.push_front(0);
	for (auto e : ls)
	{
		cout << e << " ";
	}
	cout << endl;
	ls.pop_back();
	for (auto e : ls)
	{
		cout << e << " ";
	}
	cout << endl;
	ls.pop_front();
	for (auto e : ls)
	{
		cout << e << " ";
	}
	cout << endl;
}
void test4()
{
	mylist::list<string> ls;
	ls.push_back("111");
	ls.push_back("222");
	ls.push_back("333");
	for (auto& e : ls)
	{
		cout << e << endl;
	}
	cout << endl;
}
void test5()
{
	mylist::list<string> ls;
	ls.push_back("111");
	ls.push_back("222");
	ls.push_back("333");
	auto it = ls.rbegin();
	while (it != ls.rend())
	{
		cout << *it << endl;
		cout << it->back() << endl;
		it++;
	}
	cout << endl;
}
int main()
{
	//test1();
	//test2();
	//test3();
	//test4();
	test5();
	return 0;
}